package com.xbao.controller;

import com.xbao.core.config.BusBean;
import com.xbao.core.config.BusConfig;
import com.xbao.core.http.CommRequest;
import com.xbao.core.http.CommResult;
import com.xbao.model.req.SubjectReq;
import com.xbao.service.BusConfService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;

/**
 * Created by qingshengzheng on 2019/1/23.
 */
@Api(value = "/busconfig", tags = "busconfig")
@RequestMapping(value = "busconfig")
@Controller
@EnableAutoConfiguration
public class BusConfController extends BaseController {
    @Resource
    private BusConfService busConfService;


    @ApiOperation(value = "getBusCnfonfig", notes = "getBusCnfonfig")
    @RequestMapping(value = "/conf",method = RequestMethod.POST)
    @ResponseBody
    public CommResult getBusCnfonfig(@RequestBody CommRequest<SubjectReq> balanceTypeCommRequest) {
        HashMap<String,List<BusBean>> config=busConfService.getConfig();
        return new CommResult(config);
    }
}
